//
//  GBHudTool.m
//  GBNetWork
//
//  Created by chenguibang on 16/2/22.
//  Copyright © 2016年 Chen. All rights reserved.
//

#import "GBHudUtil.h"
#import "MBProgressHUD.h"
#import "UIView+GBAnimation.h"

@interface GBHudUtil()

@end
@implementation GBHudUtil

+(void)showHud:(NSString *)text{
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:[UIApplication sharedApplication].keyWindow animated:YES];
    hud.color = [UIColor darkGrayColor];
    hud.dimBackground = NO;
    hud.userInteractionEnabled = NO;
    if (text) {
        hud.labelText = text;
    }
    hud.animationType = MBProgressHUDAnimationFade;
    hud.removeFromSuperViewOnHide = YES;
}
+(void)hideHud{
    [MBProgressHUD hideHUDForView:[UIApplication sharedApplication].keyWindow animated:NO];
}

+(void)showhint:(NSString *)text delay:(NSTimeInterval)time{
    
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:[UIApplication sharedApplication].keyWindow animated:YES];
    hud.color = [UIColor darkGrayColor];
    hud.userInteractionEnabled = NO;
    hud.margin = 15;
    hud.yOffset = -150;
    hud.mode = MBProgressHUDModeText;
    
    if (text) {
        hud.labelText = text;
    }
    hud.animationType = MBProgressHUDAnimationFade;
    hud.removeFromSuperViewOnHide = YES;
     [hud shake];
    [hud hide:NO afterDelay:time];
}
+(MBProgressHUD*)showProgressWithText:(NSString *)text{
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:[UIApplication sharedApplication].keyWindow animated:YES];
    hud.color = [UIColor darkGrayColor];
    hud.userInteractionEnabled = NO;
    if (text) {
        hud.labelText = text;
    }
//    hud.labelText  = @"下载中...";
    hud.progress = 0.5;
//    hud.color = [UIColor orangeColor];
    hud.mode = MBProgressHUDModeAnnularDeterminate;
    hud.animationType = MBProgressHUDAnimationFade;
    hud.removeFromSuperViewOnHide = YES;
    return hud;
}

@end
